

from sqlalchemy import Column, Integer, String, MetaData, Table
from sqlalchemy import UniqueConstraint
from sqlalchemy import exc as sqlexc




def create_table(engine):
    metadata = MetaData()
    try:
    
        lsb_pkg_file_Md5_table = Table('lsb_pkg_file_Md5', metadata,

            # per-column anonymous unique constraint
            Column('id', Integer, primary_key=True),

            Column('dvendor', String(32)),  # ('Ubuntu', '12.04', 'precise'), a json
            Column('dver', String(32)),  # ('Ubuntu', '12.04', 'precise'), a json
            Column('dname', String(32)),  # ('Ubuntu', '12.04', 'precise'), a json
            Column('pkg', String(128)),
            Column('file', String(256)),  # full file path form root: /usr/share/ibus-pinyin/db/android.db
    
            Column('md5sum', String(128)), # 
    
            UniqueConstraint('dvendor','dver', 'dname', 'pkg', 'file')
            )
        
        metadata.bind = engine
        #metadata.create_all(engine)
        lsb_pkg_file_Md5_table.create()
         
    except sqlexc.OperationalError:
        return



